package cn.xuchunh.campusbbs.net.params;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

/**
 * Created by XuChunH on 2015/9/12.
 */
public class TopicListParams implements Parcelable{

    private int page = 1;
    private int pageSize = 20;
    private int boardId = 0;
    private int filterId = 0;
    private int topOrder = 0;
    private int isImageList = 0;
    private String sort = "all";
    private String filterType = "";

    public TopicListParams() {
    }

    protected TopicListParams(Parcel in) {
        page = in.readInt();
        pageSize = in.readInt();
        boardId = in.readInt();
        filterId = in.readInt();
        topOrder = in.readInt();
        isImageList = in.readInt();
        sort = in.readString();
        filterType = in.readString();
    }

    public static final Creator<TopicListParams> CREATOR = new Creator<TopicListParams>() {
        @Override
        public TopicListParams createFromParcel(Parcel in) {
            return new TopicListParams(in);
        }

        @Override
        public TopicListParams[] newArray(int size) {
            return new TopicListParams[size];
        }
    };

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        if(page < 1){
            return;
        }
        this.page = page;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        if(pageSize < 1){
            return;
        }
        this.pageSize = pageSize;
    }

    public int getBoardId() {
        return boardId;
    }

    public void setBoardId(int boardId) {
        this.boardId = boardId;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        if(TextUtils.isEmpty(sort)){
            return;
        }
        this.sort = sort;
    }

    public int getFilterId() {
        return filterId;
    }

    public void setFilterId(int filterId) {
        this.filterId = filterId;
    }

    public int getTopOrder() {
        return topOrder;
    }

    public void setTopOrder(int topOrder) {
        this.topOrder = topOrder;
    }

    public int getIsImageList() {
        return isImageList;
    }

    public void setIsImageList(int isImageList) {
        this.isImageList = isImageList;
    }

    public String getFilterType() {
        return filterType;
    }

    public void setFilterType(String filterType) {
        this.filterType = filterType;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(page);
        parcel.writeInt(pageSize);
        parcel.writeInt(boardId);
        parcel.writeInt(filterId);
        parcel.writeInt(topOrder);
        parcel.writeInt(isImageList);
        parcel.writeString(sort);
        parcel.writeString(filterType);
    }
}
